『Developer Testing』
https://images-na.ssl-images-amazon.com/images/I/41auZfOzsqL.jpg
目次
Preface
Why I Wrote This Book
Target Audience
About the Examples
How to Read This Book
Acknowledgments
About the Author
Chapter 1. Developer Testing
Developers Test
Developer Testing Activities
Unit Testing
Integration Testing
Maintenance
Continuous Integration
Test Automation
What Developers Usually Don’t Do
Defining Developer Testing
Developer Testing and the Development Process
Summary
Chapter 2. Testing Objectives, Styles, and Roles
Testing and Checking
Testing Objectives
Testing to Critique
Testing to Support
Testing Styles
Traditional Testing
Agile Testing
BDD, ATDD, and Specification by Example
Your Quality Assurance and Developer Testing
Summary
Chapter 3. The Testing Vocabulary
Errors, Defects, Failures
White Box and Black Box Testing
Classifying Tests
Test Levels
Test Types
Putting Test Levels and Types to Work
The Agile Testing Quadrants
Some Other Types of Testing
Smoke Testing
End-to-End Testing
Characterization Testing
Positive and Negative Testing
Small, Medium, and Large Tests
Summary
Chapter 4. Testability from a Developer’s Perspective
Testable Software
Benefits of Testability
Its Functionality Can Be Verified
It Comes with Fewer Surprises
It Can Be Changed
Why Care about Testability
Testability Defined
Observability
Controllability
Smallness
A Reminder about Testability
Summary
Chapter 5. Programming by Contract
Contracts Formalize Constraints
Contract Building Blocks
Implementing Programming by Contract
Thinking in Contracts
Enforcing Contracts
Assertions
Libraries that Support Contracts
Unit Tests
Static Analysis
Summary
Chapter 6. Drivers of Testability
Direct Input and Output
Indirect Input and Output
State
Temporal Coupling
Data Types and Testability
Domain-to-Range Ratio
Summary
Chapter 7. Unit Testing
Why Do It?
What Is a Unit Test?
The Life Cycle of a Unit Testing Framework
Test Methods
Test Initializers and Cleanups
Constructors and Destructors
Naming Tests
Mandated by the Framework
Behavior-driven Development Style
Unit of Work, State under Test, Expected Behavior
Picking a Naming Standard
Structuring Tests
Assertion Methods
Types of Assertions
How Many Assertions per Test?
Verbosity of Assertions
Asserting Equality
Constraints and Matchers
Testing Exceptions
Behavior-driven Development–Style Frameworks
Test Structure
Naming Tests
Matchers
Summary
Chapter 8. Specification-based Testing Techniques
Equivalence Partitioning
Boundary Value Analysis
Edge Cases and Gotchas for Some Data Types
Numbers
Strings
Dates and Time
Collections
State Transition Testing
Decision Tables
Summary
Chapter 9. Dependencies
Relations between Objects
Passing in Collaborators
Using Factory Methods
Providing an External Factory or Builder
System Resource Dependencies
Files
The System Clock
Other System Resource Dependencies
Dependencies between Layers
Dependencies across Tiers
Summary
Chapter 10. Data-driven and Combinatorial Testing
Parameterized Tests
Theories
Generative Testing
Verifying the Results
Combinatorial Testing
Single-mode Faults
Double-mode Faults
Beyond Double-mode Faults and All Pairs
Summary
Chapter 11. Almost Unit Tests
Examples
Tests Using In-memory Databases
Test-specific Mail Servers
Tests Using Lightweight Containers
Tests of Web Services
Impact
Summary
Chapter 12. Test Doubles
Stubs
Stub Flexibility
Stubbing to Get Rid of Side Effects
Fakes
Mock Objects
Verifying Indirect Output
Verifying Indirect Input Transformations
Spies
Dummies
Verify State or Behavior?
State Verification
Behavior Verification
The Arguments
Summary
Chapter 13. Mocking Frameworks
Constructing Test Doubles
Setting Expectations
Stubbing
Verifying Interactions
Misuse, Overuse, and Other Pitfalls
Oververifying
Mocking Concrete Classes
Mocking Value-holding Classes
Mocks Returning Mocks
Summary
Chapter 14. Test-driven Development—Classic Style
Test-driving a Simple Search Engine
Test 1: Discovering the API
Test 2: Happy Path
Test 3: Searching in Multiple Documents
Test 4: More Sophisticated Documents
Test 5: Finding Words in Multiple Documents
Test 6: Removing Duplicate Matches
Test 7: Introducing Ranking
Test 8: Ignoring Case
Test 9: Dealing with Punctuation Marks
Order of Tests
Red- to Green-bar Strategies
Challenges
Our Code Can’t Be Tested
Our Code Is Special
Test-driven Development Isn’t Complete Testing
Starting from Zero
Test First or Test Last?
Summary
Chapter 15. Test-driven Development—Mockist Style
A Different Approach
Test-driving Customer Registration
Adding More Tests
Double-loop TDD
Another Feedback Loop
Summary
Chapter 16. Duplication
Why Duplication Is Bad
Taking Advantage of Duplication
Mechanical Duplication
Copy and Paste
Block Copy and Paste
Constructor Copy and Paste
Method Duplication
Knowledge Duplication
Similar Functionality in Different Methods
Similar Functionality in Different Classes
Competing Implementations
Competing Domain Models
Summary
Chapter 17. Working with Test Code
Commenting Tests
Strategies for Comment Avoidance
Deleting Tests
Prime Candidates for Deletion
Possible Candidates for Deletion
Why It’s Important to Delete Tests
Summary
Chapter 18. Beyond Unit Testing
Tests that Aren’t Unit Tests
Tests Enclosed in Transactions
Tests that Exercise a Service or a Component
Tests that Interact with Other Systems
Tests Running through the User Interface
Tests that Invoke a System
And There’s More
Characteristics of Tests that Aren’t Unit Tests
Complexity
Stability
Error Localization
Performance
Environmental Dependence
Target Audience
Pointers and Practices
Test Independence
Setup
Verification
Use of Test Doubles
Deciding on a Developer Testing Strategy
Summary
Chapter 19. Test Ideas and Heuristics
High-level Considerations
Test Effectiveness
Test Recipe
Level of Abstraction and Detail
Archetype
Source of Truth
Low-level Considerations
Zero-one-many
Nulls
Ranges
Collections
Exceptions and Errors
Numbers
Strings
Dates
Summary
Appendix A. Tools and Libraries
Appendix B. Source Code
Test Doubles
Data-driven and Combinatorial Testing
Test-driven Development
JUnit Version
Spock Version
Beyond Unit Testing
Bibliography
Index
Code Snippets